#include "../wxsitemresdata.h"
#include "wxsprogressdialog.h"
#include <wx/progdlg.h>


namespace {
  wxsRegisterItem<wxsProgressDialog> Reg( _T( "ProgressDialog" ), _T( "进度对话框" ), wxsTTool, _T( "对话框" ), 100, false );
  WXS_ST_BEGIN( wxsProgressDialogStyles, wxT( "wxPD_AUTO_HIDE | wxPD_APP_MODAL" ) );
  WXS_ST_CATEGORY( "wxProgressDialog" )
  WXS_ST( wxPD_APP_MODAL )
  WXS_ST( wxPD_AUTO_HIDE )
  WXS_ST( wxPD_CAN_ABORT )
  WXS_ST( wxPD_CAN_SKIP )
  WXS_ST( wxPD_ELAPSED_TIME )
  WXS_ST( wxPD_ESTIMATED_TIME )
  WXS_ST( wxPD_REMAINING_TIME )
  WXS_ST( wxPD_SMOOTH )
  WXS_ST_END()

}

wxsProgressDialog::wxsProgressDialog( wxsItemResData *Data ):
  wxsTool( Data, &Reg.Info, NULL, wxsProgressDialogStyles, ( flVariable | flId | flSubclass | flExtraCode ) ),
  m_sTitle( wxEmptyString ),
  m_sMessage( wxEmptyString ),
  m_iMaxValue( 100 ),
  m_bRunAtStartup( false ) {
}

void wxsProgressDialog::OnBuildCreatingCode() {
  switch( GetLanguage() ) {
    case wxsCPP:
      AddHeader( _T( "<wx/progdlg.h>" ), GetInfo().ClassName, 0 );
      if( m_bRunAtStartup ) {
        Codef( _T( "%C(%t, %t, %d, %W, %T);\n" ), m_sTitle.wx_str(), m_sMessage.wx_str(), m_iMaxValue );
      }
      BuildSetupWindowCode();
      break;
    case wxsUnknownLanguage:
    default:
      wxsCodeMarks::Unknown( _T( "wxsProgressDialog::OnBuildCreatingCode" ), GetLanguage() );
  }
}

void wxsProgressDialog::OnEnumToolProperties( M_Code_unused long Flags ) {
  WXS_BOOL( wxsProgressDialog, m_bRunAtStartup, _T( "Run At Startup" ), _T( "run_at_startup" ), false )
  WXS_SHORT_STRING( wxsProgressDialog, m_sTitle, _T( "Title" ), _T( "title" ), wxEmptyString, true );
  WXS_SHORT_STRING( wxsProgressDialog, m_sMessage, _T( "Message" ), _T( "message" ), wxEmptyString, true );
  WXS_LONG( wxsProgressDialog, m_iMaxValue,  _T( "Max. Value" ), _T( "max_value" ), 100 )
}
